//index.js
import route from '../../utils/route'


//获取应用实例
const app = getApp()


Page({
  data: {
    sandServerTitle: "杉德服务",
    limitServerTitle: "限时服务",
    navH: app.globalData.sysNavgationHeight,
    menuBtnRect: app.globalData.menuBtnRect,
    userName: '155****9999',
    sandServerList: [
      { id: 0, url: '../../src/img/home/index_transfer@3x.png', title: '转账' },
      { id: 1, url: '../../src/img/home/index_wallet@3x.png', title: '钱包' },
      { id: 2, url: '../../src/img/home/index_points mall@3x.png', title: '积分商城' },
      { id: 3, url: '../../src/img/home/index_card voucher@3x.png', title: '卡券' },
      { id: 4, url: '../../src/img/home/index_bill@3x.png', title: '账单' },
      { id: 5, url: '../../src/img/home/index_integral@3x.png', title: '积分' },
      { id: 6, url: '../../src/img/home/index_card@3x.png', title: '银行卡' },
      { id: 7, url: '../../src/img/home/index_ebay@3x.png', title: 'Ebay' },
    ],
    limitServerList: [
      { id: 0, url: '../../src/img/home/index_invite friends@3x.png', title: '邀请好友', desc: "好友助力 马上拿钱" },
      { id: 1, url: '../../src/img/home/index_cpu@3x.png', title: 'CPU卡圈存', desc: "cpu卡圈存" },
    ]

  },

  onLoad: function (options) {
    console.log(options)
    console.log("======> 状态栏高度:" + app.globalData.sysStatusBarHeight);
    console.log("======> 胶囊按钮rect:" + app.globalData.menuBtnRect.height);

    var curPages = getCurrentPages();
    console.log("当前页面index=>路由栈:");
    console.log(curPages);

  },

  onShow: function () {
    console.log("home页面出现")
  },

  //****************************************************** 私有方法 ******************************************************//


  // 自定义组件按钮的事件代理方法
  _iconBtnClick: function (data) {
    let tag = data.detail.btnTag;
    if (tag == 11) { //钱包
      route.push("../wallet/wallet", { pageName: "钱包首页" }, (res) => { }, (e) => { }, () => { })
    }
    if (tag == 22) { //扫一扫
      route.push("../scan/scan", { pageName: "扫一扫首页" }, (res) => { }, (e) => { }, () => { })
    }
    if (tag == 33) { //余额
      route.push("../balance/balance", { pageName: "付款首页" }, (res) => { }, (e) => { }, () => { })
    }
  },
  // 杉德服务list按钮事件
  _iconBtnClick2: function (data) {
    let index = data.detail.btnTag
    let btnTitle = data.detail.title
    wx.showToast({
      title: index + "=" + btnTitle,
      icon: 'none',
      image: '',
      duration: 1500,
      mask: false,
      success: (result) => {

      },
      fail: () => { },
      complete: () => { }
    });
  },

  // 限时服务按钮时间
  _iconBtnClick3: function (data) {
    let index = data.currentTarget.dataset.id
    wx.showToast({
      title: index+"",
      icon: 'none',
      image: '',
      duration: 1500,
      mask: false,
      success: (result) => {

      },
      fail: () => { },
      complete: () => { }
    });
  }


})
